package com.aididi.common.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName WebMvcConfig
 * @Description todo
 * @Author xuzexiang
 * @Data 2019/8/21 17:14
 */
@Configuration
public class WebMvcConfig implements  WebMvcConfigurer{
/*

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
    }
*/

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] patterns = new String[] { "/login","/*.html","/swagger-resources/**"};
        registry.addInterceptor(new SysInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(patterns);
    }

}
